package com.huwei.modules.base.controller;


import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huwei.modules.base.annotations.BussinessLog;
import com.huwei.modules.base.constant.JsonResultConstant;
import com.huwei.modules.base.util.BeanUtil;

@RestController
public class TestController {
	
	@BussinessLog(value="需要用户登录测试接口" ,key="1" ,recordResult=true)
	@RequestMapping(value="/login/hello" ,produces= MediaType.APPLICATION_JSON_UTF8_VALUE)
	public JsonResultConstant needLogin(String str) {
		return JsonResultConstant.success("this is test login controller ,and success!!");
	}
	
	@BussinessLog(value="不登录测试接口" ,key="2" ,recordResult=true)
	@RequestMapping(value="/unlogin/hello",method= {RequestMethod.GET ,RequestMethod.POST} ,produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
	public JsonResultConstant unlogin(@RequestParam(name="a",required=true)String a) {
		return JsonResultConstant.success("this is test unlogin controller ,and success!!" ,BeanUtil.toMap("a", a));
	}
}
